package com.megvii.koala.data.manager;

import com.megvii.corelib.data.BaseBean;
import com.megvii.corelib.data.BeanManager;
import com.megvii.koala.data.UrlMaker;

import java.util.Comparator;

/**
 * Created by linyue on 15/12/24.
 */

/**
 * 功能：
 * 1、设置一个url maker
 *
 * @param <T>
 */
public class KoalaBeanManager<T extends BaseBean> extends BeanManager<T>
{
    protected UrlMaker urlMaker;

    public KoalaBeanManager()
    {
        super();
    }

    public KoalaBeanManager(Comparator<T> comparator)
    {
        super(comparator);
    }

    public void setUrlMaker(UrlMaker urlMaker)
    {
        this.urlMaker = urlMaker;
    }

    protected String makeUrl(String relativeUrl)
    {
        if (urlMaker != null)
        {
            return urlMaker.makeUrl(relativeUrl);
        }
        else
        {
            return relativeUrl;
        }
    }
}
